[SUBROUTINE]
version = 1.14
icon = center-rect.png
name = _("Rectangle")
type = rectangle
help = _("<b>Create a Rectangle and align X and Y</b>&#10;Corners can be radiused or beveled")
order = act pv h10 x al_x y al_y h11 w h rot h2 ct cr h3 opt dir

[PARAM_ACT]
name = _("Active")
icon = enable.png
type = bool
value = 1

[PARAM_PV]
name = _("Show design")
icon = glasses.png
type = bool
value = 1

[PARAM_H10]
name = _("Coords")
type = sub-header

[PARAM_H11]
name = _("Size, rotation")
type = sub-header

[PARAM_X]
name = _("X")
header = h10
type = float
icon = x.png
tool_tip = _("Reference coord")
value = 0.0
metric_value = 0.0

[PARAM_AL_X]
name = _("X axis align")
icon = align-x.png
type = combo
options = _("Left=0:Center=1:Right=2")
header = h10
value = 0
tool_tip = _("Define X reference point")

[PARAM_Y]
name = _("Y")
header = h10
type = float
icon = y.png
tool_tip = _("Reference coord")
value = 0.0
metric_value = 0.0

[PARAM_AL_Y]
name = _("Y axis align")
icon = align-y.png
type = combo
options = _("Top=0:Center=1:Bottom=2")
header = h10
value = 2
tool_tip = _("Define Y reference point")

[PARAM_W]
name = _("Width")
header = h11
type = float
icon = width.png
tool_tip = _("Positive value only")
minimum_value = 0.0
value = 3
metric_value = 75
not_allowed = 0

[PARAM_H]
name = _("Height")
header = h11
type = float
icon = height.png
tool_tip = _("Positive value only")
minimum_value = 0.0
value = 2
metric_value = 50
not_allowed = 0

[PARAM_ROT]
name = _("Rotation")
header = h11
type = float
digits = 2
icon = angle.png
tool_tip = _("Angle rotated")
value = 0
suffix = &#176;

[PARAM_H2]
name = _("Corners")
type = sub-header

[PARAM_CT]
name = _("Type")
header = h2
type = combo
options = _("None=0:Rounded=1:Beveled=2:Inverted Round=3")
icon = corner-style.png
tool_tip = _("Select corner type")
value = 0

[PARAM_CR]
name = _("Radius")
header = h2
type = float
minimum_value = 0.0
icon = corner-radius.png
tool_tip = _("Radius for rounded or distance from apex")
value = 0.0
metric_value = 0.0

[PARAM_H3]
name = _("Cutting")
type = sub-header

[PARAM_OPT]
name = _("Option")
header = h3
type = combo
options = _("Inside=0:On the line=2:Outside=3")
icon = g4x.png
tool_tip = _("Select tool path")
value = 0

[PARAM_DIR]
name = _("Direction")
header = h3
type = combo
options = _("Clockwise=2:Counter-Clockwise=3")
icon = cw-ccw.png
tool_tip = _("Direction of path")
value = 3

[DEFINITIONS]
content =

[CALL]
content =
	(begin #sub_name)
	(rectangle author : Fernand Veilleux)
	o<#self_id_active> if [#param_act]
		o<#self_id_00> if [#param_h GT #param_w] (if narrower than high)
			#<h#ID>   = [#param_w]
			#<w#ID>   = [#param_h]
			#<rot#ID> = [90.0 + #param_rot]
			o<select> CALL [31] [#param_al_x] [-#<h#ID> / 2] [0] [#<h#ID> / 2]
			o<select> CALL [32] [#param_al_y] [-#<w#ID> / 2] [0] [#<w#ID> / 2]
			
		o<#self_id_00> else
			#<w#ID>   = [#param_w]
			#<h#ID>   = [#param_h]
			#<rot#ID> = #param_rot
			o<select> CALL [32] [#param_al_x] [#<w#ID> / 2] [0] [-#<w#ID> / 2]
			o<select> CALL [31] [#param_al_y] [-#<h#ID> / 2] [0] [#<h#ID> / 2]
		o<#self_id_00> endif
		
		o<get_min> CALL [37] [2] [#param_cr] [#<h#ID> / 2]
		
		o<rectangle> CALL [#param_x] [#param_y] [#<w#ID>] [#<h#ID>] [#<rot#ID>] [#32] [#31] [#param_ct] [#37] [#param_opt] [#param_dir] [#<pl_cut_start>] [#<surface>] [#<bottom>] [#param_pv]
	o<#self_id_active> endif
	(end #sub_name)
